<template>
  <div>
    <div>{{ fieldConfig.label }}</div>
    <div style="margin: 10px">
      <a-input placeholder="请输入" v-model:value="value" allow-clear/>
    </div>
  </div>
</template>
<script setup>
import {createProps} from '@/utils';
import {shallowRef} from 'vue';

defineOptions({name: 'InputSearchField'});
const props = defineProps({
  fieldConfig: createProps(Object, () => ({})),
})
const value = shallowRef();

function getParams(params) {
  if (value.value) {
    params.push({
      component: props.fieldConfig.component,
      condition: 'like',
      label: props.fieldConfig.label,
      fieldId: props.fieldConfig.id,
      fieldName: props.fieldConfig.fieldName,
      fieldValue: value.value,
      joinType: 'and',
      leftChar: '(',
      rightChar: ')',
    })
  }
}


function reset() {
  value.value = undefined;
}
defineExpose({
  getParams,
  reset
})
</script>
<style scoped lang="less">

</style>